.\"   $Id: addloins.3,v 1.1 2002/03/08 13:51:01 fred Exp $
.\" @(#)addloins.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot
.if t \{\
.so man1/alc_contents.mac
.XS \n%
.ti 0.2i
addloins
.XE
.XS2 \n%
.ti 0.2i
addloins
.XE2 \}
.TH ADDLOINS 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS"
.SH NAME
addloins \- create a logical instance
.so man1/alc_origin.1
.SH SYNOPSIS
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mlo.h"
loins_list \(**addloins(ptfig, insname, ptmodel, sigchain)
lofig_list \(**ptfig;
char \(**insname;
lofig_list \(**ptmodel;
chain_list \(**sigchain;
.ft R
.fi
.SH PARAMETERS
.TP 20
\fIptfig\fP
Pointer to the figure in which the instance should be added
.TP
\fIinsname\fP
Instance name
.TP
\fIptmodel\fP
Pointer to the instance model
.TP
\fIsigchain\fP
Pointer to chain list of signal pointers
.SH DESCRIPTION
\fBaddloins\fP creates a new instance, and adds it to the
list of instances pointed to by \fIptfig\->LOINS\fP. The new instance is 
added in front of the list, and becomes itself the list head.
.br
The parameter \fIinsname\fP fills the \fIINSNAME\fP field of the \fIloins\fP
structure.
.br
The \fIptmodel\fP is used for two purposes. First, the \fIptmodel\->NAME\fP
fills the \fIFIGNAME\fP field. Second, the connectors of the figure pointed
to by \fIptmodel\fP are duplicated in the \fILOCON\fP field, but the signals
linked to each connector are the one given in the \fIsigchain\fP argument. See
\fBchain\fP(3) for details on \fBchain_list\fPs.
.br
The matching is done in order, it means that the first connector is linked
to the first signal of the \fIsigchain\fP, and so on. Care must be taken when
instantiating in order to warranty the validity of the netlist.
For details on the structure, see \fBloins\fR(3).
.SH RETURN VALUE
\fBaddloins\fP returns a pointer to the newly created instance.
.SH ERRORS
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
"\(**\(**\(** mbk error \(**\(**\(** addloins impossible : instance \fIinsname\fP already 
exist in figure \fIptfig\->NAME\fP"
.ft R
.RS
The \fIinsname\fP is the instance identifier. So it must be unique at a given
hierarchy level.
.RE
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
"\(**\(**\(** mbk error \(**\(**\(** addloins impossible : instance model is the 
figure \fIfigname\fP itself"
.ft R
.RS
The model of the instance has the same name that the figure where the
instantiation takes place. This check is only performed for a single hierarchy
level, in terms of its instances. 
.RE
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
"\(**\(**\(** mbk error \(**\(**\(** addloins impossible : connector number discrepancy
between figure \fIptmodel\->NAME\fP and instance \fIinsname\fP
in figure \fIptfig\->NAME\fP"
.ft R
.RS
The number of signals in the \fIsigchain\fP is not equal to the number of
connectors of the model. The matching is not done correctly.
.RE
.SH EXAMPLE
.ta 3n 6n 9n 12n 15n 18n 21n
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mlo.h"
void add_na2_y(pt, in1, in2, out) /\(** add an instance of na2_y \(**/
lofig_list \(**pt; /\(** pointer to the figure \(**/
long in1, in2, out; /\(** signals indexes \(**/
{
chain_list \(**signal = NULL;
	/\(** get the pointer when signal index is known \(**/
	signal = addchain(signal, (void \(**)givelosig(pt, in1));
	signal = addchain(signal, (void \(**)givelosig(pt, in2));
	signal = addchain(signal, (void \(**)givelosig(pt, out));
	/\(** get vdd and vss \(**/
	signal = addchain(signal, (void \(**)give_vdd(pt));
	signal = addchain(signal, (void \(**)give_vss(pt));
	/\(** reverse the list \(**/
	signal = reverse(signal);
	addloins(pt, "nand", getlofig("na2_y"), signal);
}
.ft R
.fi
.SH SEE ALSO
.BR mbk (1),
.BR lofig (3),
.BR loins (3),
.BR chain (3),
.BR getloins (3),
.BR delloins (3).


.so man1/alc_bug_report.1

